//
//  listTableViewCell.m
//  Romens.XSBalance
//
//  Created by 王腾 on 16/2/23.
//  Copyright © 2016年 孙博. All rights reserved.
//

#import "listTableViewCell.h"
#import "ToolHelper.h"
@implementation listTableViewCell
// 方法重载
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self)
    {
        [self awakeFromNib];
    }
    return self;
}
- (void)awakeFromNib {
    // Initialization code
    _listImage=[[UIImageView alloc]init];
    _listImage.translatesAutoresizingMaskIntoConstraints=NO;
    [self.contentView addSubview:_listImage];
    
    self.listNameLabel=[[UILabel alloc]init];
    self.listNameLabel.translatesAutoresizingMaskIntoConstraints=NO;
    self.listNameLabel.font=systemDefaultFont;
//    [self.listNameLabel sizeToFit];
    [self.contentView addSubview:self.listNameLabel];
    
    
    _arrowImage=[[UIImageView alloc]init];
    _arrowImage.translatesAutoresizingMaskIntoConstraints=NO;
    [self.contentView addSubview:_arrowImage];
    
    [self.contentView addConstraints:[ToolHelper GetNSLayoutCont:NSDictionaryOfVariableBindings(_listImage,_listNameLabel,_arrowImage) format:@"H:|-14-[_listImage(25)]-[_listNameLabel]-[_arrowImage(20)]-8-|"]];
    [self.contentView addConstraints:[ToolHelper GetNSLayoutCont:NSDictionaryOfVariableBindings(_listImage) format:@"V:[_listImage(25)]"]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:_listImage
                                                          attribute:NSLayoutAttributeCenterY
                                                          relatedBy:NSLayoutRelationEqual
                                                             toItem:self.contentView                                              attribute:NSLayoutAttributeCenterY
                                                         multiplier:1.0f
                                                           constant:0]];
    [self.contentView addConstraints:[ToolHelper GetNSLayoutCont:NSDictionaryOfVariableBindings(_arrowImage) format:@"V:[_arrowImage(20)]"]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:_arrowImage
                                                                 attribute:NSLayoutAttributeCenterY
                                                                 relatedBy:NSLayoutRelationEqual
                                                                    toItem:self.contentView                                              attribute:NSLayoutAttributeCenterY
                                                                multiplier:1.0f
                                                                  constant:0]];
    [self.contentView addConstraints:[ToolHelper GetNSLayoutCont:NSDictionaryOfVariableBindings(_listNameLabel) format:@"V:|[_listNameLabel]|"]];

}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
